package com.project.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 用户订单表
 */

@Data
@TableName("t_user_order")
public class UserOrderEntity implements Serializable {


    @TableId(value = "pk_orderId", type = IdType.AUTO)
    private long orderId;

    @TableField("o_userRef")
    private long userRef;//用户唯一编号

    @TableField("o_orderRef")
    private String orderRef;//订单唯一编号

    @TableField("o_totalPrice")
    private double totalPrice;//付款总额

    @TableField("o_orderTime")
    private LocalDateTime orderTime = LocalDateTime.now();//订单时间

    @TableField("o_status")
    private String status;//订单状态 //订单状态码,  0未发货   1 发货  2 已完成

    @TableField("o_address")
    private String address;//收货地址

     @TableField("o_modeOfPayment")
    private int modeOfPayment;//支付方式

    @TableField(exist = false)
    private List<UserOrderInfoProductEntity> userOrderInfoProductEntityList;//订单里的所有商品

    @TableField(exist = false)
    private UserEntity userEntity;//用户订单对应的用户

    @TableField(exist = false)
    private UserOrderRefundEntity userOrderRefundEntity;//订单对应的退款订单

    public UserOrderEntity() {
    }

    public UserOrderEntity(long userRef, String orderRef, double totalPrice, String status, String address, int modeOfPayment) {
        this.userRef = userRef;
        this.orderRef = orderRef;
        this.totalPrice = totalPrice;
        this.status = status;
        this.address = address;
        this.modeOfPayment = modeOfPayment;
    }


}
